package mvc.model

class CpuInfo(val content: String) {
    val user: Long
    val nice: Long
    val system: Long
    val idle: Long
    val iowait: Long
    val irq: Long
    val softirq: Long

    init {
        val list = content.split(" ")
        user = list[2].toLong()
        nice = list[3].toLong()
        system = list[4].toLong()
        idle = list[5].toLong()
        iowait = list[6].toLong()
        irq = list[7].toLong()
        softirq = list[8].toLong()
    }

    val totalTime = user + nice + system + idle + iowait + irq + softirq

    val takeTime = user + nice + system + iowait + irq + softirq

    override fun toString(): String {
        return "user:$user\r\nnice:$nice\r\nsystem:$system\r\nidle:$idle\r\niowait:$iowait\r\nirq:$irq\r\nsoftirq:$softirq"
    }
}